package 练习2;

//数组反转

public class test09 {
    public static void main(String[] args) {
        /*int [] arr = {11,22,33,44,55,66};
        reverse(arr);
        printArray(arr);

    }
    public static void reverse(int[] arr){
        for(int start = 0, end =arr.length-1;start<=end;start++,end--){
            int temp =arr[start];
            arr[start] = arr[end];
            arr[end] = temp;
        }
    }
    public static void printArray(int[] arr){
        System.out.print("[");
        for (int i = 0; i < arr.length; i++) {
            if(i==arr.length-1){
                System.out.print(arr[i]);
            }else{
                System.out.print(arr[i]+",");
            }
        }
        System.out.println("]");*/

        int [] arr = {11,22,33,44,55};

        int [] newArr = new int[arr.length];

        int index = 0;

        for (int i = arr.length - 1; i >= 0; i--) {
            int num = arr[i];
            newArr[index] = num;
            index++;
        }
        for (int i = 0; i < arr.length; i++) {
            System.out.println(newArr[i]);
        }
    }
}
